<?php
defined( 'BASEPATH' ) or exit( 'No direct script access allowed' );
class Setting_model extends MY_Model
{
    private $_setting;
    function __construct()
    {
        parent::__construct();
        $this->_db->select( $this->_table, '`key`,`value`' );
        $configs = $this->_db->fetch_all();
        foreach ( $configs as $item )
        {
            $this->_setting[$item['key']] = $item['value'];
        }
    }
    function get($key = null)
    {
        if ($key === null)
        {
            return $this->_setting;
        }
        return isset( $this->_setting[$key] ) ? $this->_setting[$key] : null;
    }
}